1# Creating Unimodules 2 3Expo is moving towards a more extensible and configurable architecture, where different parts of the SDK can live with or without each other. We call those different parts of the SDK the Foundation unimodules. 4 5This rearchitecture will allow Expo users omit certain parts of the SDK they won't use, like Face Detector or GL. 6 7If you're interested in that topic, check out [“Chopping Expo up into universal modules to take over the world” talk](https://youtu.be/-9CJZRv7uOY) by [Stanisław Chmiela (@sjchmiela)](https://github.com/sjchmiela), which should give you some more context for why we're doing this and how it's implemented. 8 9This guide will explain how to create a unimodule and integrate it into the native Expo projects. 10 11#### Create the module 12 131. In your terminal, anywhere inside your local copy of `expo/expo`, run `et create-unimodule --name <unimodule-name>`. 142. It will guide you through the process, asking some questions about the module, like its name: 15 - If you’re creating an implementation module (your code will actually do something, expose some functionality to client code, e.g. barcode scanner), prefix the hyphenated name of your module with `expo-` (e.g. `expo-barcode-scanner`). 16 - If you’re creating an interface module (one that will be a middle-ground between a consumer and provider), prefix the hyphenated name of your module with `expo-` and end it with `-interface` (e.g. `expo-barcode-scanner-interface`). 17 - Some areas of the Expo SDK will be scoped on a name level; e.g. for analytics we know we’ll have multiple providers, so we name them `expo-analytics-branch`, `expo-analytics-segment`, etc... 18 - When it comes to CocoaPods names: `expo-module-name-something` => `EXModuleNameSomething` 19 - When it comes to Java module names: 20 - Implementation module — **`expo.modules.`**`something` 21 - Interface module — `org.unimodules.interfaces.something` 22 - Platform adapter — `expo.adapters.something` 23 - Scoped modules (e.g. analytics) — `expo.modules.scope.something` (e.g. `expo.modules.analytics.segment`) 243. Great! You should have a new directory created at `packages/<unimodule-name>`. 25 26#### Integrate with the native projects 27 281. If you **don't want** your newly created unimodule to be available in Expo Go: 29 - **iOS:** Open `ios/Podfile`, add your unimodule's name to the array passed in as the `exclude` argument of the `use_unimodules!` function call, and run `pod install`. 30 - **Android:** Open `android/expoview/build.gradle` and add your unimodule's name to the array passed in as the `exclude` option of the `addUnimodulesDependencies` function call *that is not commented out*. The one that is in the comment is used for standalone apps only. 312. Otherwise, add your module's package to `ExperiencePackagePicker.java`. This file is planned to undergo some major changes at the time of writing this guide, so just wing it. 323. If you want your module to be **unavailable** in standalone apps as well: 33 - Edit `android/app/build.gradle` by adding your unimodule's name to the array passed in as the `exclude` option of the `addMavenUnimodulesDependencies` function call. 344. You're good to go! For available API options, check out existing unimodules and [documentation of `@unimodules/core`](https://github.com/unimodules/core). 35